﻿/**
 * zebron
 * 点击客厅跳至的悬浮窗
 */

class DrawingRoomWindow extends UiFramework.Dialog
{
    onStart(divSelf: HTMLDivElement)
    {
        let rooms = new Array("客厅", "餐厅", "大厅", "小厅"); // 动态数组

        // 列表 item 
        for (let i = 0; i < 4; i++)
        {
            // 条目 div
            let divItem = document.createElement("div");
            divItem.style.width = "100%";
            divItem.style.height = "66px";
            divItem.style.zIndex = "10010";
            divItem.style.backgroundColor = "#FFFFFF";
            divItem.style.borderBottom = '2px solid #95989A';
            this.divSelf.appendChild(divItem);

            // 条目名称前图标
            let imgItem = document.createElement("img");
            imgItem.src = "picture/ic_dialog.png";
            imgItem.style.paddingTop = "24px";
            imgItem.style.paddingLeft = "30px";
            divItem.appendChild(imgItem);

            // 条目名称
            let nameItem = document.createElement("nameItem");
            nameItem.style.paddingLeft = "20px";
            nameItem.textContent = rooms[i]; // 填充内容
            divItem.appendChild(nameItem);
        }

        // 自定义 div
        let divInput = document.createElement("div");
        divInput.style.position = "absolute";
        divInput.style.width = "100%";
        divInput.style.height = "9%";
        divInput.style.zIndex = "10001";
        divInput.style.backgroundColor = "#FFFFFF";
        divInput.style.borderBottom = '2px solid #95989A';
        this.divSelf.appendChild(divInput);

        // 自定义输入框
        let accountFrame = document.createElement("input");
        accountFrame.placeholder = "自定义";
        accountFrame.style.position = "absolute";
        accountFrame.style.width = "60%";
        accountFrame.style.height = "34%";
        accountFrame.style.marginTop = "5%";
        accountFrame.style.marginLeft = "3%";
        accountFrame.style.background = "#FFFFFF";
        accountFrame.style.borderColor = "#549788";
        accountFrame.className = "inputLine";
        divInput.appendChild(accountFrame);

        // 完成按钮
        let btnFinish = document.createElement("input");
        btnFinish.type = "button";
        btnFinish.value = "完成";
        btnFinish.style.position = "absolute";
        btnFinish.style.left = "69%";
        btnFinish.style.marginTop = "4%";
        btnFinish.style.marginBottom = "1%";
        btnFinish.style.paddingTop = "3%";
        btnFinish.style.paddingBottom = "3%";
        btnFinish.style.paddingLeft = "9%";
        btnFinish.style.paddingRight = "9%";
        btnFinish.style.borderRadius = "2px";
        btnFinish.style.backgroundColor = "#549788";
        btnFinish.style.border = "none";
        btnFinish.style.color = "#FFFFFF";
        divInput.appendChild(btnFinish);

        //点击完成按钮
        btnFinish.onclick = () => {
            //测试用，暂时结束目前界面
            this.onExit();
        }
    }
}

DialogMap["drawingRoomWindow"] = () =>
{
    return new DrawingRoomWindow();
}